/*
 * RTSAI - Real-Time Strategy engine for AI research
 * Copyright(C) 2006 DIMAp-UFRN, licensed under LGPL
 *
 * Exceptions ( Exceptions.h )
 * Author: Diogo Leite Reboucas
 *         Luiz Paulo de Souza Medeiros
 *         Selan Rodrigues dos Santos
 */

#ifndef EXCEPTIONS_H_
#define EXCEPTIONS_H_

/*
#ifndef NO_RTTI
    #include <typeinfo>
#endif
*/
#include <string>
using std :: string;

class DSException
{
  public:
    DSException( const string & msg = "" ) : message( msg )
      { }
    virtual ~DSException( )
      { }
    virtual string toString( ) const
/*#ifndef NO_RTTI
      { return "Exception " + string( typeid( *this ).name( ) ) + ": " + what( ); }
#else*/
      { return "Exception " + string( ": " ) + what( ); }
//#endif
    virtual string what( ) const
      { return message; }

  private:
    string message;
};

class InvalidEntityException : public DSException
{
    public:
        InvalidEntityException ( const string& msg ) : DSException ( msg ) { }
};

class IndexOutOfBoundsException : public DSException
{
    public:
        IndexOutOfBoundsException ( const string &msg ) : DSException ( msg ) { }
};

class InvalidOperationException : public DSException
{
    public:
        InvalidOperationException ( const string &msg ) : DSException ( msg ) { }
};

class InvalidValueException : public DSException
{
    public:
        InvalidValueException ( const string &msg ) : DSException ( msg ) { }
};

// -- Matrix Exceptions

class NotSquareMatrixException : public DSException
{
    public:
        NotSquareMatrixException ( const string &msg ) : DSException ( msg ) { }
};

class InvalidMatrixOperationException : public DSException
{
    public:
        InvalidMatrixOperationException ( const string &msg ) : DSException ( msg ) { }
};

#endif
